package com.zd.springcloud.consumer.tccaction;

import io.seata.rm.tcc.api.BusinessActionContext;
import io.seata.rm.tcc.api.BusinessActionContextParameter;
import io.seata.rm.tcc.api.LocalTCC;
import io.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface AccountAction {

    /**
     *  try阶段
     */

    @TwoPhaseBusinessAction(useTCCFence = true,name = "reduceMoney",commitMethod = "commit",rollbackMethod = "rollback")
    void reduceMoney(BusinessActionContext businessActionContext,
                  @BusinessActionContextParameter("money") double money,
                  @BusinessActionContextParameter("accountId") long accountId);

    void commit(BusinessActionContext businessActionContext);


    void rollback(BusinessActionContext businessActionContext);
}
